package com.pwt.entity;

import io.swagger.v3.oas.annotations.media.Schema;
import com.pwt.entity.base.BaseEntity;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

import lombok.EqualsAndHashCode;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import java.util.List;
import java.util.Set;


/**
 * Role
 *
 * @author auto generated
 * @date 2021-08-27 15:18:32
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = "[role]")
@Schema(name = "Role")
@DynamicInsert
@DynamicUpdate
public class Role extends BaseEntity {

	/**
	 * name
	 * nullable : true
	 * default  : null
	 */
	@Schema(name = "name",description = "名称")
	@NotBlank(message = "角色名称不能为空")
	@Size(min = 2,max = 6,message = "角色名称长度要大于2个字符并且少于6个字符")
	@Column(name = "name", nullable = true, length = 50)
	private String name;

	/**
	 * remark
	 * nullable : true
	 * default  : null
	 */
	@Schema(name = "remark",description = "备注")
	@Column(name = "remark", nullable = true, length = 255)
	private String remark;

	@Schema(name = "manchines",description = "机器ids")
	@Transient
	private String manchines;

	@Schema(name = "sign",description = "标记")
	@Column(name = "sign")
	@NotBlank(message = "标记不能为空")
	private String sign;

	@Transient
	@Schema(name = "menus",description = "授权菜单")
	private Set<String> menus;
}
